﻿using System;
using System.ComponentModel;
using System.Xml.Serialization;

namespace Landpy.CruiseControlNet.FacadeInterface.ConfigurationModule
{
    public abstract class Trigger : IPrimaryKey
    {
        [Browsable(false)]
        [XmlIgnore]
        public Guid Id { get; private set; }

        [Category("Advanced")]
        [Description("The type of trigger.")]
        [XmlIgnore]
        public TriggerType Type { get; private set; }

        [Category("Basic")]
        [Description("The condition that should be used to launch the integration. By default, this value is IfModificationExists," +
                     " meaning that an integration will only be triggered if modifications have been detected. " +
                     "Set this attribute to ForceBuild in order to ensure that a build should be launched regardless of whether new modifications are detected.")]
        [XmlAttribute("buildCondition")]
        public TriggerBuildConditionType BuildConditionType { get; set; }

        protected Trigger(TriggerType triggerType)
        {
            Type = triggerType;
            this.Id = Guid.NewGuid();
        }
    }
}